import { createApp } from 'vue'
import App from './App.vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import '@/styles/index.scss' // global css
import router from '@/router'
import globalComponents from '@/components' // 全局组件
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import 'normalize.css/normalize.css'
import 'virtual:svg-icons-register'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import '@/permission' // 引入路由权限控制

const app = createApp(App)
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)

app.use(pinia)
app.use(router)
app.use(globalComponents)
app.use(ElementPlus, {
  locale: zhCn,
})
// 注册ElementPlus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.mount('#app')
